/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package domain;

import domain.exceptions.CannotFlagWallSquareException;
import domain.exceptions.CannotPlaceAgentHereException;

/**
 *
 * @author shaigi
 */
public class SquareFree extends Square{
    
    public SquareFree(int row, int column){
        setRow(row);
        setColumn(column);
        try {
            setFlag(null);
        } catch (CannotFlagWallSquareException ex) {
            System.out.println(ex.getMessage());
        }
    }

    @Override
    public String toString(){
        return "Free Square " + toStringLocation();
    }

    public void placeAgent(Agent agent) throws CannotPlaceAgentHereException{
        try {
            agent.getSquare().removeAgent();
        } catch (Exception ex) {
            System.out.println(ex.getMessage());
        }
        setAgent(agent);
    }
    
}
